<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="alternate" href="/atom.xml" title="刘攀的个人专栏" type="application/atom+xml">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('http://liupan.run').hostname,
    root: '/',
    scheme: 'Pisces',
    version: '7.5.0',
    exturl: false,
    sidebar: {"position":"right","Pisces | Gemini":240,"display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="1.CentOS7系统准备购买腾讯云服务器-略">
<meta name="keywords" content="nginx,centos,hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="001-在腾讯云CentOS7上使用Hexo-Github-Jupyter-Nginx搭建个人博客及notebook">
<meta property="og:url" content="http:&#x2F;&#x2F;liupan.run&#x2F;2019&#x2F;11&#x2F;28&#x2F;001-%E5%9C%A8%E8%85%BE%E8%AE%AF%E4%BA%91CentOS7%E4%B8%8A%E4%BD%BF%E7%94%A8Hexo-Github-Jupyter-Nginx%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E5%8F%8Anotebook&#x2F;index.html">
<meta property="og:site_name" content="刘攀的个人专栏">
<meta property="og:description" content="1.CentOS7系统准备购买腾讯云服务器-略">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-01-02T11:44:32.577Z">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://liupan.run/2019/11/28/001-%E5%9C%A8%E8%85%BE%E8%AE%AF%E4%BA%91CentOS7%E4%B8%8A%E4%BD%BF%E7%94%A8Hexo-Github-Jupyter-Nginx%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E5%8F%8Anotebook/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>001-在腾讯云CentOS7上使用Hexo-Github-Jupyter-Nginx搭建个人博客及notebook | 刘攀的个人专栏</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">刘攀的个人专栏</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">面朝大海,春暖花开</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签<span class="badge">28</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类<span class="badge">0</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档<span class="badge">20</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://liupan.run/2019/11/28/001-%E5%9C%A8%E8%85%BE%E8%AE%AF%E4%BA%91CentOS7%E4%B8%8A%E4%BD%BF%E7%94%A8Hexo-Github-Jupyter-Nginx%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E5%8F%8Anotebook/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="liupan">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="刘攀的个人专栏">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          001-在腾讯云CentOS7上使用Hexo-Github-Jupyter-Nginx搭建个人博客及notebook
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-11-28 14:16:16" itemprop="dateCreated datePublished" datetime="2019-11-28T14:16:16+08:00">2019-11-28</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-01-02 19:44:32" itemprop="dateModified" datetime="2020-01-02T19:44:32+08:00">2020-01-02</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="1-CentOS7系统准备"><a href="#1-CentOS7系统准备" class="headerlink" title="1.CentOS7系统准备"></a>1.CentOS7系统准备</h2><h3 id="购买腾讯云服务器-略"><a href="#购买腾讯云服务器-略" class="headerlink" title="购买腾讯云服务器-略"></a>购买腾讯云服务器-略</h3><a id="more"></a>

<h3 id="CentOS系统配置-7-7"><a href="#CentOS系统配置-7-7" class="headerlink" title="CentOS系统配置(7.7)"></a>CentOS系统配置(7.7)</h3><h4 id="添加用户"><a href="#添加用户" class="headerlink" title="添加用户"></a>添加用户</h4><figure class="highlight mipsasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">adduser </span> liu  <span class="comment">#添加用户</span></span><br><span class="line">passwd liu   <span class="comment">#设置密码</span></span><br></pre></td></tr></table></figure>

<p>修改权权 vim /etc/sudoers<br>liu  ALL=(ALL)   ALL</p>
<h4 id="基础软件安装"><a href="#基础软件安装" class="headerlink" title="基础软件安装"></a>基础软件安装</h4><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo yum <span class="keyword">install</span> -y wget vim curl</span><br></pre></td></tr></table></figure>



<h4 id="查看磁盘命令参考"><a href="#查看磁盘命令参考" class="headerlink" title="查看磁盘命令参考"></a>查看磁盘命令参考</h4><blockquote>
<p> lsblk,du,disk -l,free -h, cfdisk /dev/vda,df -h</p>
</blockquote>
<h4 id="安装最新版git"><a href="#安装最新版git" class="headerlink" title="安装最新版git"></a>安装最新版git</h4><figure class="highlight crystal"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install openssl openssl-devel curl-devel expat-devel  <span class="comment">#安装依赖</span></span><br><span class="line">cd ~<span class="regexp">/download</span></span><br><span class="line"><span class="regexp">wget https:/</span><span class="regexp">/mirrors.edge.kernel.org/pub</span><span class="regexp">/software/scm</span><span class="regexp">/git/git</span>-<span class="number">2.24</span>.<span class="number">0</span>.tar.xz</span><br><span class="line">xz -d git-<span class="number">2.24</span>.<span class="number">0</span>.tar.xz</span><br><span class="line">tar -xvf git-<span class="number">2.24</span>.<span class="number">0</span>.tar</span><br><span class="line">cd git-<span class="number">2.24</span>.<span class="number">0</span></span><br><span class="line">sudo make prefix=<span class="regexp">/usr/local</span><span class="regexp">/git  all</span></span><br><span class="line"><span class="regexp">sudo make prefix=/usr</span><span class="regexp">/local/git</span>  install</span><br></pre></td></tr></table></figure>

<p>添加git路径至PATH,vim /etc/profile 添加至最后；</p>
<blockquote>
<p>export PATH=$PATH:/usr/local/git/bin </p>
</blockquote>
<p>或者采用以下命令<br>echo “export PATH=$PATH:/usr/local/git/bin” &gt;&gt; /etc/profile</p>
<p>git基本配置</p>
<figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C xxxxx@xx.com  # .ssh/id_rsa.pub  copy <span class="keyword">to</span> github</span><br><span class="line">git<span class="built_in"> config </span>--global user.name  xxxx</span><br><span class="line">git<span class="built_in"> config </span>--global user.email xxx@xx.com</span><br><span class="line">git<span class="built_in"> config </span>--global core.editor vim</span><br></pre></td></tr></table></figure>

<p>git关联远程库</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">git</span> <span class="selector-tag">init</span></span><br><span class="line"><span class="selector-tag">git</span> <span class="selector-tag">remote</span> <span class="selector-tag">add</span> <span class="selector-tag">origin</span> <span class="selector-tag">git</span>@<span class="keyword">github</span>.<span class="keyword">com</span>/<span class="keyword">xxxx</span>/<span class="keyword">note</span>.<span class="keyword">git</span></span><br><span class="line"><span class="keyword">git</span> push origin -u master  # 初次使用-u,再次使用不用-u</span><br><span class="line">git push oritin master</span><br></pre></td></tr></table></figure>



<h4 id="安装zsh及oh-my-zsh配置"><a href="#安装zsh及oh-my-zsh配置" class="headerlink" title="安装zsh及oh-my-zsh配置"></a>安装zsh及oh-my-zsh配置</h4><figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">su</span> <span class="string">liu</span></span><br><span class="line"><span class="attr">sudo</span> <span class="string">yum install zsh </span></span><br><span class="line"><span class="attr">chsh</span> <span class="string">-s /bin/zsh</span></span><br><span class="line"><span class="attr">sh</span> <span class="string">-c "curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh"</span></span><br></pre></td></tr></table></figure>

<p>安装autojump插件</p>
<figure class="highlight angelscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install <span class="built_in">auto</span>jump <span class="built_in">auto</span>jump-zsh</span><br></pre></td></tr></table></figure>

<p>安装高亮插件</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https:<span class="regexp">//gi</span>thub.com<span class="regexp">/zsh-users/</span>zsh-syntax-highlighting.git <span class="variable">$&#123;ZSH_CUSTOM:-~/.oh-my-zsh/custom&#125;</span><span class="regexp">/plugins/</span>zsh-syntax-highlighting</span><br></pre></td></tr></table></figure>

<p>安装powerline字体</p>
<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">cd</span> ~</span><br><span class="line">git clone https:<span class="string">//github.com/powerline/fonts.git</span></span><br><span class="line"><span class="string">./fonts/install.sh</span>   <span class="comment">#安装至 ~/.local/share/fonts</span></span><br><span class="line">rm -rf <span class="string">./fonts</span></span><br></pre></td></tr></table></figure>

<p>配置插件 vim ~/.zshrc</p>
<blockquote>
<p>plugins=(git zsh-autosuggestions zsh -syntax-highlinhting autojump)</p>
</blockquote>
<h4 id="SSH登录腾讯云服务器"><a href="#SSH登录腾讯云服务器" class="headerlink" title="SSH登录腾讯云服务器"></a>SSH登录腾讯云服务器</h4><ol>
<li><p>登录腾讯云控制台-&gt; SSH密钥-&gt; 创建,并下载-&gt;关机-&gt; 绑定主机 -&gt;启动主机</p>
</li>
<li><p>使用putty访问时，需使用PuttyGen进行转换【存在不兼容】,PuttyGen-&gt;ImportKey-&gt;SavePrivateKey</p>
</li>
<li><p>在Putty中加载密钥文件,Connection-&gt;SSH-&gt;Auth-&gt;Browser-&gt;选择转换后的文件</p>
</li>
<li><p>sudo vim /etc/ssh/sshd_config</p>
<p> PasswordAuthentication yes</p>
</li>
</ol>
<h4 id="VSCode配置远程访问"><a href="#VSCode配置远程访问" class="headerlink" title="VSCode配置远程访问"></a>VSCode配置远程访问</h4><ol>
<li>安装Remote-SSH插件并配置,配置内容如下：vim ~/.ssh/config<br>Host my_server<br>HostName 111.233.111.111<br>User liu<br>Identiy D:\path\to\ppkfile</li>
</ol>
<h4 id="查看系统版本"><a href="#查看系统版本" class="headerlink" title="查看系统版本"></a>查看系统版本</h4><figure class="highlight arduino"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/redhat-<span class="built_in">release</span></span><br></pre></td></tr></table></figure>

<h2 id="2-Anaconda安装"><a href="#2-Anaconda安装" class="headerlink" title="2.Anaconda安装"></a>2.Anaconda安装</h2><h3 id="安装anaconda"><a href="#安装anaconda" class="headerlink" title="安装anaconda"></a>安装anaconda</h3><p>wget <a href="https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh" target="_blank" rel="noopener">https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh</a><br>./Anaconda3-2019.10-Linux-x86_64.sh</p>
<h3 id="PATH配置vim-etc-profile"><a href="#PATH配置vim-etc-profile" class="headerlink" title="PATH配置vim /etc/profile"></a>PATH配置vim /etc/profile</h3><p>export PATH=$PATH:/home/anaconda3/bin<br>source /etc/profile</p>
<h3 id="生成配置文件-设置密码"><a href="#生成配置文件-设置密码" class="headerlink" title="生成配置文件,设置密码"></a>生成配置文件,设置密码</h3><figure class="highlight verilog"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">jupyternotebook --<span class="keyword">generate</span>-<span class="keyword">config</span></span><br><span class="line">jupyter notebook password  #设置密码</span><br></pre></td></tr></table></figure>



<h3 id="必要配置-vim-jupyter-jupyter-notebook-config-py"><a href="#必要配置-vim-jupyter-jupyter-notebook-config-py" class="headerlink" title="必要配置 vim ~/.jupyter/jupyter_notebook_config.py"></a>必要配置 vim ~/.jupyter/jupyter_notebook_config.py</h3><p>c.NotebookApp.ip=’*’<br>c.NotebookApp.open_browser=False<br>c.NotebookApp.port=8888<br>c.NotebookApp.notebook_dir=”/home/liu/my-jupyter-data”</p>
<h3 id="安装扩展程序"><a href="#安装扩展程序" class="headerlink" title="安装扩展程序"></a>安装扩展程序</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">pip <span class="keyword">install</span> jupyter_contrib_nbextensions</span><br><span class="line">jupyter contrib nbextension <span class="keyword">install</span> <span class="comment">--user</span></span><br><span class="line">jupyter nbextension <span class="keyword">enable</span> codefolding/<span class="keyword">main</span></span><br><span class="line">pip <span class="keyword">install</span> jupyterthemes  <span class="comment">#主题</span></span><br></pre></td></tr></table></figure>

<h3 id="安装其他内核kernel"><a href="#安装其他内核kernel" class="headerlink" title="安装其他内核kernel"></a>安装其他内核kernel</h3><figure class="highlight mipsasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">pip <span class="keyword">install </span><span class="keyword">bash_kernel</span></span><br><span class="line"><span class="keyword">python </span>-m <span class="keyword">bash_kernel.install</span></span><br><span class="line"><span class="keyword">jupyter </span>kernelspec list</span><br></pre></td></tr></table></figure>



<h3 id="查看进并关闭程序"><a href="#查看进并关闭程序" class="headerlink" title="查看进并关闭程序"></a>查看进并关闭程序</h3><figure class="highlight perl"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ps -ef | <span class="keyword">grep</span> jupyter</span><br><span class="line"><span class="keyword">kill</span> -<span class="number">9</span> PID</span><br></pre></td></tr></table></figure>



<h3 id="后台运行-写运行脚本-vim-run-sh"><a href="#后台运行-写运行脚本-vim-run-sh" class="headerlink" title="后台运行,写运行脚本 vim ~/run.sh"></a>后台运行,写运行脚本 vim ~/run.sh</h3><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nohup jupyter-notebook --allow-root  &gt;  /<span class="keyword">var</span>/<span class="keyword">log</span>/<span class="keyword">note</span>.<span class="keyword">log</span>  2&gt;&amp;1 &amp;</span><br></pre></td></tr></table></figure>

<h2 id="3-Nodejs安装"><a href="#3-Nodejs安装" class="headerlink" title="3.Nodejs安装"></a>3.Nodejs安装</h2><h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">wget https://npm.taobao.org/mirrors/node/v12.13.1/node-v12.13.1-linux-x64.tar.xz</span><br><span class="line">xz -d node-v12.13.1-linux-x64.tar.xz</span><br><span class="line">tar -xvf node-v12.13.1-linux-x64.tar node</span><br></pre></td></tr></table></figure>
<p>将node目录加入PATH,echo “export PATH=$PATH:~/nodejs/bin”或建立软链接</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">ln -s ~/nodejs/bin/node  /usr/bin/node</span><br><span class="line">ln -s ~/nodejs/bin/npm  /usr/bin/npm</span><br><span class="line">ln -s ~/nodejs/bin/npx  /usr/bin/npx</span><br></pre></td></tr></table></figure>
<h3 id="配置源"><a href="#配置源" class="headerlink" title="配置源"></a>配置源</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">npm config <span class="built_in">set</span> registry https://registry.npm.taobao.org</span><br><span class="line">npm config get registry</span><br><span class="line">npm install -g cnpm --registry=https://registry.npm.taobao.org</span><br><span class="line">cnpm install -g @vue/cli </span><br><span class="line">cnpm install -g webpack</span><br></pre></td></tr></table></figure>
<h2 id="4-Hexo应用"><a href="#4-Hexo应用" class="headerlink" title="4.Hexo应用"></a>4.Hexo应用</h2><h3 id="hexo安装-注意添加路径至PATH"><a href="#hexo安装-注意添加路径至PATH" class="headerlink" title="hexo安装(注意添加路径至PATH)"></a>hexo安装(注意添加路径至PATH)</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">cnpm install -g hexo-cli</span><br><span class="line">cnpm i hexo-deployer-git --save</span><br><span class="line">cnpm i hexo-generator-feed  --save</span><br><span class="line">cnpm i hexo-generator-searchdb --save</span><br><span class="line">cnpm i hexo-generator-index --save</span><br><span class="line">cnpm i hexo-generator-archive  --save</span><br><span class="line">cnpm i hexo-generator-tag --save</span><br></pre></td></tr></table></figure>

<h3 id="创建应用"><a href="#创建应用" class="headerlink" title="创建应用"></a>创建应用</h3><figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">hexo</span> <span class="string">init myblog</span></span><br><span class="line"><span class="attr">cd</span> <span class="string">myblog</span></span><br><span class="line"><span class="attr">npm</span> <span class="string">install</span></span><br></pre></td></tr></table></figure>



<h3 id="创建文章"><a href="#创建文章" class="headerlink" title="创建文章"></a>创建文章</h3><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo new <span class="string">"title"</span></span><br><span class="line">hexo new<span class="built_in"> page </span>--path about/me <span class="string">"About me"</span></span><br></pre></td></tr></table></figure>



<h3 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h3><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">hexo publish [layout] <span class="string">"filename"</span></span><br><span class="line">hexo serer -p -s -l</span><br><span class="line">hexo deploy</span><br><span class="line">hexo render file1  file2  </span><br><span class="line">hexo migrate <span class="string">"type"</span></span><br><span class="line">hexo clean</span><br><span class="line">hexo list</span><br><span class="line">hexo --safe  </span><br><span class="line">hexo --debug</span><br><span class="line">hexo --silent</span><br><span class="line">hexo --draft</span><br><span class="line">hexo<span class="built_in"> server </span>-i 192.168.1.1</span><br></pre></td></tr></table></figure>



<h3 id="安装额外应用及主题"><a href="#安装额外应用及主题" class="headerlink" title="安装额外应用及主题"></a>安装额外应用及主题</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm <span class="keyword">install</span> hexo-<span class="keyword">server</span> <span class="comment">--save</span></span><br><span class="line">git <span class="keyword">clone</span> https://github.com/iissnan/hexo-theme-<span class="keyword">next</span> themes/<span class="keyword">next</span></span><br></pre></td></tr></table></figure>




<h3 id="部署至Github"><a href="#部署至Github" class="headerlink" title="部署至Github"></a>部署至Github</h3><p>在github创建项目 myname.github.io.git<br>git add push正常操作即可预览效果</p>
<h3 id="自动部署-hexo-g-d-即同步至github主页"><a href="#自动部署-hexo-g-d-即同步至github主页" class="headerlink" title="自动部署 hexo g -d 即同步至github主页"></a>自动部署 hexo g -d 即同步至github主页</h3><p>vim ./myblog/_config.yml 添加内容</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">- type: git </span><br><span class="line">  repo: https://github.com/xxxx/xxxx.github.io.git</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
<p>部署<br>hexo clean<br>hexo g -d</p>
<p>部署后生成的静态文件在public文件夹中</p>
<h3 id="nginx安装"><a href="#nginx安装" class="headerlink" title="nginx安装"></a>nginx安装</h3><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install -y nginx</span><br><span class="line">service nginx start</span><br><span class="line">vim /etc/nginx/nginx.conf</span><br><span class="line">sudo nginx -s reload</span><br></pre></td></tr></table></figure>

<h3 id="nginx配置-–给-myblog-public-文件设置代理即可"><a href="#nginx配置-–给-myblog-public-文件设置代理即可" class="headerlink" title="nginx配置 –给./myblog/public 文件设置代理即可"></a>nginx配置 –给./myblog/public 文件设置代理即可</h3><p>sudo vim /etc/nginx/nginx.conf</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">user root; #必须设置root否则会有权限问题</span><br><span class="line">...</span><br><span class="line">server &#123;</span><br><span class="line">        listen       80 default_server;</span><br><span class="line">        server_name     111.231.141.333; #ip或域名</span><br><span class="line">        root    /home/liu/myblog/public;</span><br><span class="line">        location / &#123;</span><br><span class="line">                root /home/liupan/my-projects/myblog/public; #public路径</span><br><span class="line">                index index.html index.htm;</span><br><span class="line">        &#125;</span><br></pre></td></tr></table></figure>
<p>sudo nginx -s reload  #即可重新加载</p>
<h2 id="5-Jupyter使用Nginx代理"><a href="#5-Jupyter使用Nginx代理" class="headerlink" title="5.Jupyter使用Nginx代理"></a>5.Jupyter使用Nginx代理</h2><p>sudo vim /etc/nginx/nginx.conf  #添加内容location</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">location /note &#123;</span><br><span class="line">        proxy_pass      http://127.0.0.1:8888/note;</span><br><span class="line">        #proxy_redirect http://localhost:8888/  $scheme://$host/;</span><br><span class="line">        proxy_redirect  off;</span><br><span class="line">        proxy_set_header        Host    $host;</span><br><span class="line">        proxy_set_header        X-Real-IP       $remote_addr;</span><br><span class="line">        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;</span><br><span class="line">        proxy_set_header        REMOTE-HOST     $remote_addr;</span><br><span class="line"></span><br><span class="line">        proxy_connect_timeout   30s;</span><br><span class="line">        proxy_read_timeout      86400;</span><br><span class="line">        proxy_send_timeout      30s;</span><br><span class="line">        proxy_http_version      1.1;</span><br><span class="line">        proxy_set_header        Upgrade $http_upgrade;</span><br><span class="line">        proxy_set_header        Connection      &quot;upgrade&quot;;</span><br><span class="line">        expires 12h;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo nginx -s reload</span></span><br></pre></td></tr></table></figure>



<h2 id="6-运行"><a href="#6-运行" class="headerlink" title="6.运行"></a>6.运行</h2><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">hexo</span> g -d  <span class="comment">#重新部署</span></span><br></pre></td></tr></table></figure>



    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/nginx/" rel="tag"># nginx</a>
              <a href="/tags/centos/" rel="tag"># centos</a>
              <a href="/tags/hexo/" rel="tag"># hexo</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2010/01/02/015-Python%E6%8B%BC%E9%9F%B3%E4%BD%BF%E7%94%A8/" rel="prev" title="015-Python拼音使用">
      <i class="fa fa-chevron-left"></i> 015-Python拼音使用
    </a></div>
      <div class="post-nav-item">
    <a href="/2019/11/30/007-Manjaro%E5%88%9D%E5%A7%8B%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85%E3%80%81%E7%BE%8E%E5%8C%96%E5%8F%8A%E4%BC%98%E5%8C%96%E9%85%8D%E7%BD%AE%E8%AE%B0%E5%BD%95/" rel="next" title="007-Manjaro初始软件安装、美化及优化配置记录">
      007-Manjaro初始软件安装、美化及优化配置记录 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-CentOS7系统准备"><span class="nav-text">1.CentOS7系统准备</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#购买腾讯云服务器-略"><span class="nav-text">购买腾讯云服务器-略</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#CentOS系统配置-7-7"><span class="nav-text">CentOS系统配置(7.7)</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#添加用户"><span class="nav-text">添加用户</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#基础软件安装"><span class="nav-text">基础软件安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#查看磁盘命令参考"><span class="nav-text">查看磁盘命令参考</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#安装最新版git"><span class="nav-text">安装最新版git</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#安装zsh及oh-my-zsh配置"><span class="nav-text">安装zsh及oh-my-zsh配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#SSH登录腾讯云服务器"><span class="nav-text">SSH登录腾讯云服务器</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#VSCode配置远程访问"><span class="nav-text">VSCode配置远程访问</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#查看系统版本"><span class="nav-text">查看系统版本</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-Anaconda安装"><span class="nav-text">2.Anaconda安装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装anaconda"><span class="nav-text">安装anaconda</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#PATH配置vim-etc-profile"><span class="nav-text">PATH配置vim /etc/profile</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#生成配置文件-设置密码"><span class="nav-text">生成配置文件,设置密码</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#必要配置-vim-jupyter-jupyter-notebook-config-py"><span class="nav-text">必要配置 vim ~/.jupyter/jupyter_notebook_config.py</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装扩展程序"><span class="nav-text">安装扩展程序</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装其他内核kernel"><span class="nav-text">安装其他内核kernel</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#查看进并关闭程序"><span class="nav-text">查看进并关闭程序</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#后台运行-写运行脚本-vim-run-sh"><span class="nav-text">后台运行,写运行脚本 vim ~/run.sh</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-Nodejs安装"><span class="nav-text">3.Nodejs安装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装"><span class="nav-text">安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置源"><span class="nav-text">配置源</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-Hexo应用"><span class="nav-text">4.Hexo应用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#hexo安装-注意添加路径至PATH"><span class="nav-text">hexo安装(注意添加路径至PATH)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建应用"><span class="nav-text">创建应用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建文章"><span class="nav-text">创建文章</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常用命令"><span class="nav-text">常用命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装额外应用及主题"><span class="nav-text">安装额外应用及主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#部署至Github"><span class="nav-text">部署至Github</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#自动部署-hexo-g-d-即同步至github主页"><span class="nav-text">自动部署 hexo g -d 即同步至github主页</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#nginx安装"><span class="nav-text">nginx安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#nginx配置-–给-myblog-public-文件设置代理即可"><span class="nav-text">nginx配置 –给./myblog/public 文件设置代理即可</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-Jupyter使用Nginx代理"><span class="nav-text">5.Jupyter使用Nginx代理</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-运行"><span class="nav-text">6.运行</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="liupan"
      src="/images/avatar.gif">
  <p class="site-author-name" itemprop="name">liupan</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">20</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">28</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="feed-link motion-element">
    <a href="/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/facetothesea" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;facetothesea" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/mailto:hbxgliupan@sina.com" title="E-Mail → mailto:hbxgliupan@sina.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">liupan</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.0.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.5.0
  </div>

        








        
      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>



  




  <script src="/js/local-search.js"></script>













  

  

  

</body>
</html>
